-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cloudpickle incompatibilities on early Python 3.5 versions #361
Conversation
Codecov Report
@@ Coverage Diff @@
## master #361 +/- ##
=======================================
Coverage 92.95% 92.95%
=======================================
Files 2 2
Lines 809 809
Branches 164 164
=======================================
Hits 752 752
Misses 29 29
Partials 28 28 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First batch of reviews:
da2631e
to
7996513
Compare
rebased. |
…le into cloudpickle-py350
Maybe it's not worth fighting with the CI too much to test Python 3.5.0... I will test this PR one more time locally. |
Cool. |
How did you install Python 3.5.0 to run your tests? From source? I cannot find it with conda. |
let me know when if it works locally - if so, I'll clean up the CI additions in this PR. |
Using
|
Ok I managed to run the tests of this PR successfully using python:3.5.0 from docker. |
From your last CI run:
That's an interesting error message ;) I am not sure what it means. Anyways, feel free to rollback the CI changes and merge this PR to make the release. |
Great. I'm quickly testing 3.5.1 and 3.5.2 while I'm at it, and i'll merge. |
Actually I made a mistake when testing with Python 3.5.0. I had forgotten to install the typing_extensions package. If I do so I get the following failure: ___________________________________________________________________ CloudPickleTest.test_generic_extensions ____________________________________________________________________
self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_generic_extensions>
def test_generic_extensions(self):
typing_extensions = pytest.importorskip('typing_extensions')
objs = [
typing_extensions.Literal,
typing_extensions.Final,
typing_extensions.Literal['a'],
typing_extensions.Final[int],
]
for obj in objs:
depickled_obj = pickle_depickle(obj, protocol=self.protocol)
> assert depickled_obj == obj
tests/cloudpickle_test.py:2137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.5/site-packages/typing_extensions.py:653: in __eq__
if not isinstance(other, Literal):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = typing_extensions.Literal, obj = typing_extensions.Literal
def __instancecheck__(self, obj):
> raise TypeError("Literal cannot be used with isinstance().")
E TypeError: Literal cannot be used with isinstance().
/usr/local/lib/python3.5/site-packages/typing_extensions.py:624: TypeError
|
What kind of can of worms is this..... |
TypeVar objects are not weakreferable in early Python 3.5
The test suite passes locally on Let's sleep on it until tomorrow morning and then release. |
I confirm the tests now pass on my local 3.5.0. I will test each other 3.5.x version with docker and then review the diff.
|
For your information, here is the command line I use to run the tests with docker: docker run --rm -v `pwd`:/io -ti python:3.5.2 \
bash -c "cd /io/ && pip install -e . psutil pytest typing_extensions && pytest -v" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should restore TypeVar
tracking, at least for recent Python versions (>= 3.6).
name, *constraints, bound=bound, | ||
covariant=covariant, contravariant=contravariant | ||
) | ||
return _lookup_class_or_track(class_tracker_id, tv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you track TypeVar
defintions anymore? This seems unrelated to the change to support early 3.5.x.
Doesn't this change break ant test?
Edit: I see you removed test_pickle_dynamic_typevar_tracking
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also won't this break unpickling objects pickled with cloudpickle 1.4.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TyperVar
instances are not weakreferable in Python 3.5.3
..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also won't this break unpickling objects pickled with cloudpickle 1.4.0?
We can always restore the class_tracker_id
for backward compat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TyperVar instances are not weakreferable in Python 3.5.3..
I re-ran the tests with old Python 3.5.x and they pass...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum you are right they fail just for 3.5.3 ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok let me do a workaround for 3.5.3.
Ok I re-enabled dynamic |
I'm not sure we can. See #361 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more comments:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now! Thanks very much @pierreglaser.
Closes #360 .
cloudpickle 1.4.0
is not compatible with earlyPython 3.5
versions.This should fix it.
Note that I did not set up any CI for
Python 3.5.[0-2]
, I simply tested it on my machine using freshconda
envs.@vedran If you have some time, could you tell me if this branch fixes the problems that made you create #360?
I would be tempted to release a bugfix version by tonight since this bug completely breaks
cloudpickle
onPython 3.5
.